package com.jxd.ordersys.controller;

import com.jxd.ordersys.model.OrderEmp;
import com.jxd.ordersys.model.OrderMeal;
import com.jxd.ordersys.model.OrderRequest;
import com.jxd.ordersys.model.Orders;
import com.jxd.ordersys.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @ClassName OrderController
 * @Description TODO
 * @Author 王云超
 * @Date 2024/9/20 10:24
 * @Version 1.0
 */
@RestController
public class OrdersController {
    @Autowired
    IOrdersService ordersService;

    @RequestMapping("/delOrder")
    public String delOrder(@RequestBody List<Integer> orderIds){
        boolean delFlag = ordersService.delOrder(orderIds);
        if (delFlag){
            return "success";
        }else {
            return "error";
        }
    }

    @RequestMapping("/creatOrEditOrder")
    public String creatOrEditOrder(@RequestBody OrderRequest orderRequest){
        boolean flag = ordersService.createOrEditOrder(orderRequest);
        if (flag) {
            return "success";
        } else {
            return "error";
        }
    }

}